package cn.laixueit.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author duxiang
 * @date 2023/11/27 11:04
 */
@Configuration
public class MPConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        PaginationInnerInterceptor mysqlDB = new PaginationInnerInterceptor(DbType.MYSQL);
        mysqlDB.setMaxLimit(100l);
        interceptor.addInnerInterceptor(mysqlDB);
        return interceptor;
    }

    @Bean
    public MPAutoConfig mpAutoConfig(){
        return new MPAutoConfig();
    }
}
